<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计时器</title>
    <script src="dist/counter.js"></script>
</head>

<body>
    <button id="btn"> 开始 </button>
    <img src="https://img.alicdn.com/imgextra/i3/O1CN01oK2CyB1OknjiADBJ5_!!6000000001744-1-tps-1040-384.gif" alt="">
</body>
<script>
    /**
     * start, end, time = 0, run_callback
     * */
     var imgs = document.querySelector("img");
    const t = timer(360,0, 2, {
        onChange(e){
            console.log(e)
            imgs.style.transform = `rotate(${e}deg)`
        },
        onEnd(e){
            console.error(e)
        }
    });
    document.querySelector("#btn").onclick = () => { t.run() };
</script>

</html>